from init import create_app
import sys, platform, os

print(platform.system())
print(sys.argv)
if (platform.system() == 'Windows' or platform.system() == 'Darwin'):
    try:
        name = sys.argv[1]
        if name not in ['test', 'dev']:
            raise Exception('count not found % config' % name)
        else:
            print(name)
            app = create_app(name)
    except:
        print('test')
        app = create_app()

if __name__ == '__main__':
    if (platform.system() == 'Windows' or platform.system() == 'Darwin'):
        app.run(host='0.0.0.0',port=8000)
    else:
        os.system('nohup gunicorn -w 5 wsgi:application -b 0.0.0.0 &')
